<template>
  <view class="textare">
    <custom-navi :show-home="false">
      编辑到店券
      <view slot="right" class="nav-right" @tap="handleSave">保存</view>
    </custom-navi>
    <view class="textare-box">
      <textarea
        placeholder="请输入文字描述,不得超过1000字"
        :value="val"
        @input="bindTextAreaBlur"
      />
    </view>
  </view>
</template>

<script>
export default {
  data () {
    return {
      val: ''
    }
  },
  // onUnload () {
  //   uni.$off()
  // },
  onShow() {
  	const _self = this
  	uni.getStorage({
  	    key: 'introduce',
  	    success: function (res) {
  	        // console.log(res.data);
  			_self.val = res.data
  	    }
  	});
  },
  methods: {
    bindTextAreaBlur: function (e) {
      this.val = e.detail.value
    },
    handleSave () {
      // uni.$emit('add', { val: this.val })
	  uni.setStorageSync('introduce',this.val );
      this.$utils.common.navigateBack()
    }
  },
}
</script>
<style>
page {
  background-color: #ffffff;
}
</style>
<style lang="scss" scoped>
.textare {
  &-box {
    padding: 30rpx 50rpx;
    textarea::placeholder {
      font-size: 28rpx;
      font-family: PingFang SC;
      font-weight: 400;
      line-height: 64rpx;
      color: rgba(183, 183, 183, 1);
    }
  }
  .nav-right {
    font-size: 32rpx;
    font-family: PingFang SC;
    font-weight: 500;
    color: rgba(255, 255, 255, 1);
    opacity: 1;
  }
}
</style>